package com.cosmoplat.xikai.business.enums;

import lombok.Getter;

import java.math.BigDecimal;

/**
 * @ClassName ProductCodeEnum
 * @Description 产品枚举
 * @Author wdf
 * @Date 2025/1/23
 */


@Getter
public enum ProductEnum {


    /**
     * 5KA.206.140   126
     * 5KA.206.10024  252
     * 5KA.206.10024  40.5
     **/

    /**
     * 转序：
     * 成品托126  20个    40.5/252成品托12个
     **/
    P_5KA_206_140("GIS021(ZF23)", "5KA.206.140", "126", 20, "1"),
    P_5KA_206_10024("GIS022", "5KA.206.10024", "252", 12, "2"),
//    P_5KA_206_10024_40_5("", "5KA.206.10024", "40.5", 12, "3");
    P_5KA_206_10036("GIS0204", "5KA.206.10036", "40.5", 12, "3");

    private String code;
    private String productCode;
    private String name;
    private Integer transferNum;
    private String param;

    ProductEnum(String code, String productCode, String name, Integer transferNum, String param) {
        this.code = code;
        this.productCode = productCode;
        this.name = name;
        this.transferNum = transferNum;
        this.param = param;
    }

    public static BigDecimal getProductEnumByCode(String code) {
        for (ProductEnum productEnum : ProductEnum.values()) {
            if (productEnum.getCode().equals(code)) {
                return new BigDecimal(productEnum.getTransferNum());
            }
        }
        return null;
    }

    public static String getParam(String param) {
        for (ProductEnum productEnum : ProductEnum.values()) {
            if (productEnum.getCode().equals(param)) {
                return productEnum.getParam();
            }
        }
        return null;
    }
}
